package com.ly.datacenter.component.pager.pojo;
/**
 * function：
 * @author watson  email: watson.wu@hotmail.com
 * @date 2009-9-7
 */
public class OraclePagination {
	
	public static String getPaginationSql(String sql, int page, int pagesize) {
		StringBuffer pagingQuery = new StringBuffer();
		int startIndex = (page-1) * pagesize+1;
		int endIndex = page * pagesize-1;
		pagingQuery.append("select * from ( select temp.*, rownum rownum_ from ( ").append(sql).append("  ) temp where ROWNUM <= " + endIndex).append(" ) WHERE  num >= " + startIndex);
		return pagingQuery.toString();
	}

}

